<template>
  <div class="page-content">
    <div class="page-left">
      <div class="page-top">
        <dv-border-box-8 :color="[mainColorOpcity, mainColor]"><panel1 ref="panel1"></panel1></dv-border-box-8>
      </div>
      <div class="page-center">
        <panel2 ref="panel2"> </panel2>
      </div>
      <div class="page-bottom">
        <dv-border-box-8 :color="[mainColorOpcity, mainColor]"><panel3 ref="panel3"></panel3></dv-border-box-8>
      </div>
    </div>
    <div class="page-right">
      <dv-border-box-8 :color="[mainColorOpcity, mainColor]"><panel4 ref="panel4"></panel4></dv-border-box-8>
    </div>
  </div>
</template>

<script>
import panel1 from './components/panel1.vue'
import panel2 from './components/panel2.vue'
import panel3 from './components/panel3.vue'
import panel4 from './components/panel4.vue'

export default {
  name: 'index',
  components: { panel1, panel2, panel3, panel4 },
  props: {
    source: String,
    mainColor: String,
    mainColorOpcity: String,
  },
  data() {
    return {
      key: new Date().toLocaleTimeString(),
    }
  },
  mounted() {
    window.onresize = () => {
      // 可视区域的高度
      const clientHeight = document.documentElement.clientHeight || document.body.clientHeight
      // screen是window的属性方法，window.screen可省略window，指的是窗口
      this.isFull = screen.height == clientHeight
      this.$refs.panel1.onResize()
      this.$refs.panel2.onResize()
      this.$refs.panel3.onResize()
      this.$refs.panel4.onResize()
    }
  },
  destroyed() {
    window.onresize = null
  },
  methods: {},
}
</script>

<style scoped lang="scss">
$bgColor: #060a22;
$mainColor: #68cee0;
$mainColorOpcity: rgba(104, 206, 224, 0.3);

.page-content {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  .page-left {
    flex: 1 1 auto;
    width: 50vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow: hidden;
    .page-top {
      width: 100%;
      height: calc(35% - 5px);
      flex: 0 0 auto;
      margin-bottom: 5px;
    }
    .page-center {
      width: 100%;
      height: 45%;
      margin-bottom: 5px;
    }
    .page-bottom {
      width: 100%;
      height: calc(20% - 5px);
      flex: 0 0 auto;
    }
  }
  .page-right {
    flex: 1 1 auto;
    width: 50vw;
    height: 100%;
    overflow: hidden;
  }
}
</style>
